Optimal. Leaf size=410 \[ -\frac {i 2^{-2-n} e^{-i (2 a+c n)-i (2 b+d n) x+i n (c+d x)} \left (1-e^{2 i c+2 i d x}\right )^{-n} \left (i e^{-i (c+d x)}-i e^{i (c+d x)}\right )^n \, _2F_1\left (\frac {1}{2} \left (-\frac {2 b}{d}-n\right ),-n;\frac {1}{2} \left (2-\frac {2 b}{d}-n\right );e^{2 i (c+d x)}\right )}{2 b+d n}+\frac {i 2^{-2-n} e^{i (2 a-c n)+i (2 b-d n) x+i n (c+d x)} \left (1-e^{2 i c+2 i d x}\right )^{-n} \left (i e^{-i (c+d x)}-i e^{i (c+d x)}\right )^n \, _2F_1\left (\frac {1}{2} \left (\frac {2 b}{d}-n\right ),-n;\frac {1}{2} \left (2+\frac {2 b}{d}-n\right );e^{2 i (c+d x)}\right )}{2 b-d n}+\frac {i 2^{-1-n} \left (i e^{-i (c+d x)}-i e^{i (c+d x)}\right )^n \left (1-e^{2 i (c+d x)}\right )^{-n} \, _2F_1\left (-n,-\frac {n}{2};1-\frac {n}{2};e^{2 i (c+d x)}\right )}{d n} \]
[Out]
________________________________________________________________________________________
Rubi [A]
time = 0.69, antiderivative size = 410, normalized size of antiderivative = 1.00, number of steps
used = 15, number of rules used = 10, integrand size = 17, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.588, Rules used = {4649, 2320,
2005, 2057, 372, 371, 2323, 2285, 2284, 2283} \begin {gather*} -\frac {i 2^{-n-2} \left (i e^{-i (c+d x)}-i e^{i (c+d x)}\right )^n \left (1-e^{2 i c+2 i d x}\right )^{-n} \, _2F_1\left (\frac {1}{2} \left (-\frac {2 b}{d}-n\right ),-n;\frac {1}{2} \left (-\frac {2 b}{d}-n+2\right );e^{2 i (c+d x)}\right ) \exp (-i (2 a+c n)-i x (2 b+d n)+i n (c+d x))}{2 b+d n}+\frac {i 2^{-n-2} \left (i e^{-i (c+d x)}-i e^{i (c+d x)}\right )^n \left (1-e^{2 i c+2 i d x}\right )^{-n} \, _2F_1\left (\frac {1}{2} \left (\frac {2 b}{d}-n\right ),-n;\frac {1}{2} \left (\frac {2 b}{d}-n+2\right );e^{2 i (c+d x)}\right ) \exp (i (2 a-c n)+i x (2 b-d n)+i n (c+d x))}{2 b-d n}+\frac {i 2^{-n-1} \left (i e^{-i (c+d x)}-i e^{i (c+d x)}\right )^n \left (1-e^{2 i (c+d x)}\right )^{-n} \, _2F_1\left (-n,-\frac {n}{2};1-\frac {n}{2};e^{2 i (c+d x)}\right )}{d n} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
Rule 371
Rule 372
Rule 2005
Rule 2057
Rule 2283
Rule 2284
Rule 2285
Rule 2320
Rule 2323
Rule 4649
Rubi steps
\begin {align*} \int \sin ^2(a+b x) \sin ^n(c+d x) \, dx &=2^{-2-n} \int \left (2 \left (i e^{-i (c+d x)}-i e^{i (c+d x)}\right )^n-e^{-2 i a-2 i b x} \left (i e^{-i (c+d x)}-i e^{i (c+d x)}\right )^n-e^{2 i a+2 i b x} \left (i e^{-i (c+d x)}-i e^{i (c+d x)}\right )^n\right ) \, dx\\ &=-\left (2^{-2-n} \int e^{-2 i a-2 i b x} \left (i e^{-i (c+d x)}-i e^{i (c+d x)}\right )^n \, dx\right )-2^{-2-n} \int e^{2 i a+2 i b x} \left (i e^{-i (c+d x)}-i e^{i (c+d x)}\right )^n \, dx+2^{-1-n} \int \left (i e^{-i (c+d x)}-i e^{i (c+d x)}\right )^n \, dx\\ &=-\frac {\left (i 2^{-1-n}\right ) \text {Subst}\left (\int \frac {\left (-\frac {i \left (-1+x^2\right )}{x}\right )^n}{x} \, dx,x,e^{i (c+d x)}\right )}{d}-\left (2^{-2-n} e^{i n (c+d x)} \left (i-i e^{2 i c+2 i d x}\right )^{-n} \left (i e^{-i (c+d x)}-i e^{i (c+d x)}\right )^n\right ) \int e^{-2 i a-2 i b x-i n (c+d x)} \left (i-i e^{2 i c+2 i d x}\right )^n \, dx-\left (2^{-2-n} e^{i n (c+d x)} \left (i-i e^{2 i c+2 i d x}\right )^{-n} \left (i e^{-i (c+d x)}-i e^{i (c+d x)}\right )^n\right ) \int e^{2 i a+2 i b x-i n (c+d x)} \left (i-i e^{2 i c+2 i d x}\right )^n \, dx\\ &=-\frac {\left (i 2^{-1-n}\right ) \text {Subst}\left (\int \frac {\left (\frac {i}{x}-i x\right )^n}{x} \, dx,x,e^{i (c+d x)}\right )}{d}-\left (2^{-2-n} e^{i n (c+d x)} \left (i-i e^{2 i c+2 i d x}\right )^{-n} \left (i e^{-i (c+d x)}-i e^{i (c+d x)}\right )^n\right ) \int e^{i (2 a-c n)+i (2 b-d n) x} \left (i-i e^{2 i c+2 i d x}\right )^n \, dx-\left (2^{-2-n} e^{i n (c+d x)} \left (i-i e^{2 i c+2 i d x}\right )^{-n} \left (i e^{-i (c+d x)}-i e^{i (c+d x)}\right )^n\right ) \int e^{-i (2 a+c n)-i (2 b+d n) x} \left (i-i e^{2 i c+2 i d x}\right )^n \, dx\\ &=-\left (\left (2^{-2-n} e^{i n (c+d x)} \left (1-e^{2 i c+2 i d x}\right )^{-n} \left (i e^{-i (c+d x)}-i e^{i (c+d x)}\right )^n\right ) \int e^{i (2 a-c n)+i (2 b-d n) x} \left (1-e^{2 i c+2 i d x}\right )^n \, dx\right )-\left (2^{-2-n} e^{i n (c+d x)} \left (1-e^{2 i c+2 i d x}\right )^{-n} \left (i e^{-i (c+d x)}-i e^{i (c+d x)}\right )^n\right ) \int e^{-i (2 a+c n)-i (2 b+d n) x} \left (1-e^{2 i c+2 i d x}\right )^n \, dx-\frac {\left (i 2^{-1-n} \left (e^{i (c+d x)}\right )^n \left (i e^{-i (c+d x)}-i e^{i (c+d x)}\right )^n \left (i-i e^{2 i (c+d x)}\right )^{-n}\right ) \text {Subst}\left (\int x^{-1-n} \left (i-i x^2\right )^n \, dx,x,e^{i (c+d x)}\right )}{d}\\ &=-\frac {i 2^{-2-n} \exp (-i (2 a+c n)-i (2 b+d n) x+i n (c+d x)) \left (1-e^{2 i c+2 i d x}\right )^{-n} \left (i e^{-i (c+d x)}-i e^{i (c+d x)}\right )^n \, _2F_1\left (\frac {1}{2} \left (-\frac {2 b}{d}-n\right ),-n;\frac {1}{2} \left (2-\frac {2 b}{d}-n\right );e^{2 i (c+d x)}\right )}{2 b+d n}+\frac {i 2^{-2-n} \exp (i (2 a-c n)+i (2 b-d n) x+i n (c+d x)) \left (1-e^{2 i c+2 i d x}\right )^{-n} \left (i e^{-i (c+d x)}-i e^{i (c+d x)}\right )^n \, _2F_1\left (\frac {1}{2} \left (\frac {2 b}{d}-n\right ),-n;\frac {1}{2} \left (2+\frac {2 b}{d}-n\right );e^{2 i (c+d x)}\right )}{2 b-d n}-\frac {\left (i 2^{-1-n} \left (e^{i (c+d x)}\right )^n \left (i e^{-i (c+d x)}-i e^{i (c+d x)}\right )^n \left (1-e^{2 i (c+d x)}\right )^{-n}\right ) \text {Subst}\left (\int x^{-1-n} \left (1-x^2\right )^n \, dx,x,e^{i (c+d x)}\right )}{d}\\ &=-\frac {i 2^{-2-n} \exp (-i (2 a+c n)-i (2 b+d n) x+i n (c+d x)) \left (1-e^{2 i c+2 i d x}\right )^{-n} \left (i e^{-i (c+d x)}-i e^{i (c+d x)}\right )^n \, _2F_1\left (\frac {1}{2} \left (-\frac {2 b}{d}-n\right ),-n;\frac {1}{2} \left (2-\frac {2 b}{d}-n\right );e^{2 i (c+d x)}\right )}{2 b+d n}+\frac {i 2^{-2-n} \exp (i (2 a-c n)+i (2 b-d n) x+i n (c+d x)) \left (1-e^{2 i c+2 i d x}\right )^{-n} \left (i e^{-i (c+d x)}-i e^{i (c+d x)}\right )^n \, _2F_1\left (\frac {1}{2} \left (\frac {2 b}{d}-n\right ),-n;\frac {1}{2} \left (2+\frac {2 b}{d}-n\right );e^{2 i (c+d x)}\right )}{2 b-d n}+\frac {i 2^{-1-n} \left (i e^{-i (c+d x)}-i e^{i (c+d x)}\right )^n \left (1-e^{2 i (c+d x)}\right )^{-n} \, _2F_1\left (-n,-\frac {n}{2};1-\frac {n}{2};e^{2 i (c+d x)}\right )}{d n}\\ \end {align*}
________________________________________________________________________________________
Mathematica [F]
time = 0.43, size = 0, normalized size = 0.00 \begin {gather*} \int \sin ^2(a+b x) \sin ^n(c+d x) \, dx \end {gather*}
Verification is not applicable to the result.
[In]
[Out]
________________________________________________________________________________________
Maple [F]
time = 0.08, size = 0, normalized size = 0.00 \[\int \left (\sin ^{2}\left (b x +a \right )\right ) \left (\sin ^{n}\left (d x +c \right )\right )\, dx\]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Maxima [F]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \text {Failed to integrate} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Fricas [F]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \text {could not integrate} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Sympy [F(-1)] Timed out
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \text {Timed out} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Giac [F]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \text {could not integrate} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Mupad [F]
time = 0.00, size = -1, normalized size = -0.00 \begin {gather*} \int {\sin \left (a+b\,x\right )}^2\,{\sin \left (c+d\,x\right )}^n \,d x \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________